<template>
	<div>
		<mu-dialog :open="openData.openState" title="请选择任务状态" @close="taskStatusClose">

			<mu-raised-button v-if="openData.btnOk" label="已完成，待审核！" class="raised-button mb_20" backgroundColor="#a4c639"
				fullWidth @click="setTaskStatus(2, '已完成，待审核！')"/>

			<mu-raised-button v-if="openData.btnExamine" label="已完成并审核通过！" class="raised-button mb_20" primary
				fullWidth @click="setTaskStatus(3, '已完成并审核通过！')"/>

			<mu-raised-button v-if="openData.btnDanger" label="审核不合格！" class="raised-button" secondary
				fullWidth @click="setTaskStatus(1, '审核不合格！')"/>

		    <mu-flat-button v-if="openData.btnEdit" slot="actions" @click="editTask()" primary label="编辑任务"/>
		    <mu-flat-button v-if="openData.btnDel" slot="actions" @click="setTaskStatus(9)" secondary label="删除任务"/>
		    <mu-flat-button slot="actions" @click="taskStatusClose" label="取消"/>
		</mu-dialog>
	</div>
</template>

<script>
import axios from 'axios'
export default{
	props: {
		openData: {
			openState: false,	//开启状态
			btnOk: false,		//已完成，待审核
			btnExamine: false,	//已完成并审核通过
			btnDanger: false,	//审核不合格
			btnEdit: false,		//编辑任务
			btnDel: false,		//删除任务
			tid: null			//任务id
		}
	},
	methods: {
		//设置任务状态
		setTaskWindow(tid){	//任务弹窗
			this.openData.openState = true;
		},
		taskStatusClose(){	//任务关闭
			this.openData.openState = false;
		},
		setTaskStatus(type, str){	//设置任务状态
			let params = {
					tid: this.openData.tid,
					status: type
				};
			axios.post($base + 'task/setTaskStatus', params).then(json => {
				this.alertData = {
					openState: true,
					content: '状态设置成功！'
				};
				this.taskStatusClose();
				this.$store.commit('examineListen')
			}).catch(json => {

			})
		},
		editTask(){	//编辑任务

		}
	},
	mounted(){
	}
}
</script>